#ifndef QTableWidgetOperate_H
#define QTableWidgetOperate_H

#include <QTableWidget>
#include <QMouseEvent>
#include <QPoint>

class QTableWidgetOperate : public QTableWidget
{
    Q_OBJECT
public:
    explicit QTableWidgetOperate(int row = 0, int column = 0, QWidget *parent = nullptr);

    void setScrollSpeed(double speed = 1); //设置速度
protected:
    void mousePressEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;

private:
    bool m_middleButtonPressed;
    QPoint m_lastPos;
    double scroll_speed; //! 设置鼠标滑动的速度
};

#endif // QTableWidgetOperate_H    
